<div class="row animated" ng-class="{true: 'fadeInRight', false:'fadeInLeft'}[currentAnimated]">
  <div class="panel panel-default">
    <div class="panel-heading">
      <a ng-click="discard()" href="javascript:;"><i class="backBtn fa fa-arrow-circle-left"></i></a>
      <span class="panelTitle" ng-bind="ArticleForm.title"></span>
    </div>
    <div class="panel-body">
      <form novalidate name="articleForm" class="form-horizontal" role="form">
        <div class="form-group" ng-class="{'has-error': articleForm.title.$invalid && articleForm.title.$dirty}">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>标题：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control" name="title" placeholder="文章标题" ng-model="article.title" required>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">子标题：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control" name="subTitle" placeholder="子标题" ng-model="article.subTitle" >
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.content.$invalid && articleForm.content.$dirty}">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>内容：</label>
          <div class="col-xs-7 col-md-8">
            <textarea name="content" placeholder="发表的文章内容" id="editor" bind-model="article.content" ng-bind-html="article.content | trustHtml" keditor data-config="options" required ng-model="article.contentBody">
            </textarea>
            <autosave module="article" saveId="{{article.id}}" interval="30000"></autosave>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>文章摘要：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control" name="summary" placeholder="文章摘要" ng-model="article.summary">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">文章来源：</label>
          <div class="col-xs-7 col-md-8">
            <textarea name="content2" style="width: 100%;height:80px" placeholder="文章来源" id="editor2" bind-model="article.source" ng-model="article.sourceBody">
            </textarea>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.author.$invalid && articleForm.author.$dirty}">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>作者：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w25c" name="author" placeholder="作者" ng-model="article.author" required>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.editor.$invalid && articleForm.editor.$dirty}">
          <label class="control-label col-xs-3 col-md-2">汇编者：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w25c" name="editor" placeholder="汇编者" ng-model="article.editor">
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.inputer.$invalid && articleForm.inputer.$dirty}">
          <label class="control-label col-xs-3 col-md-2">录入者：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w25c" name="inputer" placeholder="录入者" ng-model="article.inputer">
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.auditor.$invalid && articleForm.auditor.$dirty}">
          <label class="control-label col-xs-3 col-md-2">审批者：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w25c" name="auditor" placeholder="审批者" ng-model="article.auditor">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">显示风格：</label>
          <div class="col-xs-7 col-md-8">
            <div class="row">
              <div class="col-xs-6 col-md-4">
                <div class="pad10">
                  <input type="radio" name="layout" value="big" ng-model="article.layout" />大图布局(单张大图，宽高比8:3)
                </div>
                <div class="pad10">
                  <img src="images/transparent.png" width="100%" height="120" alt="" class="article-thumb">
                </div>
              </div>
              <div class="col-xs-6 col-md-4">
                <div class="pad10">
                  <input type="radio" name="layout" value="small" ng-model="article.layout" />小图布局(2张小图，宽高比4:3)
                </div>
                <div class="pad10">
                  <img src="images/transparent.png" width="49%" height="120" alt="" class="article-thumb">
                  <img src="images/transparent.png" width="49%" height="120" alt="" class="article-thumb">
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>文章图标：</label>
          <div class="col-xs-7 col-md-8">            
            <div class="button btn btn-primary fl" ngf-select="upload($files)" multiple="multiple" ngf-pattern="'image/*'"
              ngf-accept="'image/*'" ngf-max-size="10MB">上传图片</div>
            <a href="javascript:void(0)" class="btn btn-info ml15" ng-click="openPhotoLibs()">图片库</a><span class="clearfix"></span>              
            <iconlist></iconlist>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">标签：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w120 input-tags" name="tags" id="tags" placeholder="标签" ng-model="queryTag" autocomplete="off">
            <tags elemId="tags"></tags>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.category.$invalid && articleForm.category.$dirty}">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>分类：</label>
          <div class="col-xs-7 col-md-8">
            <select class="form-control w25c" name="category" required ng-model="article.category">
              <option value="">----选择分类----</option>
              <option ng-repeat="item in article.categoryList" value="{{item.id}}">{{item.name}}</option>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">相关商品</label>
          <div class="col-xs-7 col-md-8">
            <div><button class="btn btn-primary" data-toggle="modal" data-target="#chooseProductModal">选择商品</button><button class="btn btn-primary ml15" ng-click="cleanProducts()">清空关联商品</button></div>
            <div class="row" ng-repeat="item in selectedProducts track by $index">
              <div class="col-xs-2 thumbnail" ng-if="item.pictures.length"><img ng-if="item.pictures.length" ng-src="{{'/ps/download/' + item.pictures[0].id}}" width="96" border="0"/></div>
              <div class="col-xs-2 thumbnail" ng-if="!item.pictures.length"><img src="images/defaultIcon.jpg" width="96" border="0"/></div>
              <div class="col-xs-4">{{item.name}}</div>
              <div class="col-xs-2">¥{{item.price}}</div>
              <div class="col-xs-4"><span class="btn btn-primary" ng-click="removeProduct($index)">删除</span></div>
            </div>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.relateTitle.$invalid && articleForm.relateTitle.$dirty}" ng-show="selectedProducts && selectedProducts.length">
          <label class="control-label col-xs-3 col-md-2">相关商品标题：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w25c" name="relateTitle" placeholder="相关商品标题" ng-model="article.relateTitle">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">文章视频</label>
          <div class="col-xs-7 col-md-8">
            <div class="row pb5" ng-repeat="video in videos">
              <div class="col-xs-3">
                <select class="form-control" name="type" ng-model="videos[$index].type">
                  <option ng-repeat="item in videoTypes" value="{{item.propertyName}}">{{item.value}}</option>
                </select>
              </div>
              <div class="col-xs-5">
                <input type="text" class="form-control" name="video" placeholder="腾讯云视频" ng-model="videos[$index].url">
              </div>
              <div class="col-xs-4">
                <button class="btn btn-primary" ng-click="addVideo()">新增</button>
                <button class="btn btn-primary ml15" ng-if="$index >= 1 && videos.length > 1" ng-click="removeVideo($index)">删除</button>
              </div>
            </div>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.videoTitle.$invalid && articleForm.videoTitle.$dirty}">
          <label class="control-label col-xs-3 col-md-2">视频标题：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w25c" name="videoTitle" placeholder="视频标题" ng-model="article.videoTitle">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>微信分享图：</label>
          <div class="col-xs-7 col-md-8">
            <img ng-if="article.wxiconurl" ng-src="{{article.wxiconurl}}" width="80" border="0" class="fl whiteblock">
            <div class="button btn btn-primary fl" ngf-select="uploadPic($file)" ngf-pattern="'image/*'"
              ngf-accept="'image/*'" ngf-max-size="10MB">上传图片</div>
          </div>
        </div>
        <div class="form-group" ng-class="{'has-error': articleForm.postTime.$invalid && articleForm.postTime.$dirty}">
          <label class="control-label col-xs-3 col-md-2"><font color="red">*</font>发布年份：</label>
          <div class="col-xs-7 col-md-8">
            <input type="text" class="form-control w25c" name="postTime" id="postTime" idate placeholder="发布年份" ng-model="article.postTime" required>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">浏览数：</label>
          <div class="col-xs-7 col-md-8">
            <input type="number" class="form-control w25c" name="pv" placeholder="浏览数" ng-model="article.pv">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">文章排序：</label>
          <div class="col-xs-7 col-md-8">
            <input type="number" class="form-control w25c" name="sort" placeholder="排序值" ng-model="article.sort">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">权限：</label>
          <div class="col-xs-7 col-md-8">
            <input type="radio" class="form-control" value="true" name="isPublic" icheck ng-model="article.isPublic">公开&nbsp;&nbsp;
            <input type="radio" class="form-control" value="false" name="isPublic" icheck ng-model="article.isPublic">私有
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-xs-3 col-md-2">其它设置：</label>
          <div class="col-xs-7 col-md-8">
            <input type="checkbox" class="form-control" name="isOriginal" icheck ng-model="article.isOriginal">原创&nbsp;&nbsp;
            <input type="checkbox" class="form-control" name="isTop" icheck ng-model="article.isTop">置顶&nbsp;&nbsp;
            <input type="checkbox" class="form-control" name="isRecommend" icheck ng-model="article.isRecommend">推荐
          </div>
        </div>
        <div class="form-group">
          <div class="col-xs-4 col-xs-offset-2">
            <button class="btn btn-primary" ng-click="submitForm()" ng-disabled="articleForm.$invalid">发表</button>
            <button class="btn btn-primary" ng-click="saveForm()" ng-disabled="articleForm.$invalid">保存草稿</button>
            <button class="btn btn-white" ng-click="discard()">取消</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<imagepreview></imagepreview>
<upload-task></upload-task>

<script src="libs/kindeditor/kindeditor.js" type="text/javascript"></script>
<script src="libs/kindeditor/lang/zh-CN.js" type="text/javascript"></script>